#pragma once
#include<iostream>

#define Die(code)       \
        do              \
        {               \
            exit(code); \
        } while(0)

#define CONV(v) (struct sockaddr*) (v)

enum
{
    USAGE_ERR = 1 ,
    SOCKET_ERR,
    BIND_ERR
};

//切分字符串
bool SplitString(std::string &line,std::string *l_key,std::string *r_value , const std::string &sep)
{
    
    auto pos = line.find(sep);
    if(pos == std::string::npos) return false;//pos为：下标

    //左闭右开
    *l_key = line.substr(0,pos);
    *r_value = line .substr(pos+sep.size());

    if(l_key->empty() || r_value->empty()) return false;
    return true;
}